home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 17
/
AMIGAplus Sonderheft 17 (1999)(ICP)(DE)[!].iso
/
PD
/
Anwendungen
/
AmiCAD
/
ARexx
/
Cartouche.amiCAD
< prev
next >
Wrap
Text File
|
1998-06-17
|
4KB
|
156 lines
/* Script ARexx permettant le tracé d'un cartouche dans une fenêtre AmiCAD */
/* Chez Corbin, Vendredi 3 Octobre 1997, Version 1.00, © R.Florac */
/* Version 1.01, 2 Novembre 1997, trait vertical rajouté dans cartouche */
/* Version 1.02, 23 janvier 1998, ajout titre, date, etc... */
/* Version 1.03, 12 février 1998, test longueurs chaînes pour ajustement largeur */
/* Version 1.04, 24 mai 1998, test présence rexxlocaldates.library */
/* $VER: Cartouche.AmiCAD 1.04 (© R.Florac, 13/04/98) */
options results
organisation="LYCÉE Bernard PALISSY SAINTES"
signal on error
signal on syntax
if (~show('L','rexxlocaldates.library')) then
call addlib('rexxlocaldates.library',0,-30,0)
if (show('L','rexxlocaldates.library')) then do
Ib = OpenLocale()
jour = FormatDate(Ib, ,"%A %e %B %Y")
end
else do
'DATE(1)'; jour=result
end
'WWIDTH(-1)'; l = result; lc = result % 3
'WHEIGHT(-1)'; h =result
'ROTATE(0,0):SYMMETRY(0,0)'
'SELECT("Emplacement du cartouche"+CHR(10)+"En haut à gauche"+CHR(10)+"En haut à droite"+CHR(10)+"En haut au centre"+CHR(10)+"En bas au centre"+CHR(10)+"En bas à droite"+CHR(10)+"En bas à gauche")'
c = result
'ASK("Titre du cartouche")'; titre = result
if titre='' then exit
if lc<260 then lc=260
'TXWIDTH("'organisation'")'; lt = result
if lt>lc-10 then lc=lt+10
'TXWIDTH("'titre'")'; lt = result
if lt>lc-10 then lc=lt+10
dx=(lc+5)%4*3
'TXWIDTH("'jour'")'; lt = result
if lt>dx-10 then do
dx=lt+10
lc=dx%3*4
end
select
when c = 1 then do /* En haut à gauche */
x0 = 5
x1 = lc + 5
y0 = 5
y1 = 85
bh = 0
bb = 1
bg = 0
bd = 1
end
when c = 2 then do /* En haut à droite */
x0 = l - lc - 5
x1 = l - 5
y0 = 5
y1 = 85
bh = 0
bb = 1
bg = 1
bd = 0
end
when c = 3 then do /* En haut au centre */
x0 = l % 2 - lc % 2
x1 = x0 + lc
y0 = 5
y1 = 85
bh = 0
bb = 1
bg = 1
bd = 1
end
when c = 4 then do /* En bas au centre */
x0 = l % 2 - lc % 2
x1 = x0 + lc
y0 = h - 85
y1 = h - 5
bh = 1
bb = 0
bg = 1
bd = 1
end
when c = 6 then do /* En bas à gauche */
x0 = 5
x1 = 5 + lc
y0 = h - 85
y1 = h - 5
bh = 1
bb = 0
bg = 0
bd = 1
end
when c = 5 then do /* En bas à droite */
x0 = l - lc - 5
x1 = l - 5
y0 = h - 85
y1 = h - 5
bh = 1
bb = 0
bg = 1
bd = 0
end
otherwise exit
end
/* sauvegarde du contexte, dessin du contour */
'SAVEALL(-1):DRAWMODE(2):DRAW(5,5,'l-5',5):DRAW('l-5',5,'l-5','h-5')'
'DRAW('l-5','h-5',5,'h-5'):DRAW(5,'h-5',5,5)'
/* Tracé du bord horizontal haut */
if bh > 0 then 'DRAW('x0','y0','x1','y0')'
/* Tracé du bord horizontal bas */
if bb > 0 then 'DRAW('x0','y1','x1','y1')'
/* Tracé du bord vertical gauche */
if bg > 0 then 'DRAW('x0','y0','x0','y1')'
/* Tracé du bord vertical droit */
if bd > 0 then 'DRAW('x1','y0','x1','y1')'
/* Tracé des lignes horizontales intermédiaires */
'DRAW('x0','y0+20','x1','y0+20')'
'DRAWMODE(1):DRAW('x0','y0+40','x1','y0+40'):DRAW('x0','y0+60','x1','y0+60')'
/* Tracé de la ligne verticale intermédiaire */
'DRAW('dx+x0','y0+40','dx+x0','y1')'
'SETSCALE(0,1,1)'
call centrer_texte(organisation,x0,x1,y0+15)
call centrer_texte(titre,x0,x1,y0+35)
call centrer_texte(jour,x0,x0+dx,y0+75)
call centrer_texte("Document Numéro 1/1",x0,x0+dx,y0+55)
call centrer_texte("REV 1",x0+dx,x1,y0+55)
call centrer_texte("AmiCAD",x0+dx,x1,y0+75)
exit
centrer_texte: procedure
parse arg texte, xg, xd, y
'TXWIDTH("'texte'")'; l = result
l = (xd-xg-l)%2
'WRITE("'texte'",'xg+l','y')'
return
/* Traitement des erreurs, interruption du programme */
syntax:
erreur=RC
'MESSAGE("Script Cartouche.AmiCAD:"+CHR(10)+"Erreur de syntaxe"+CHR(10)+"en ligne 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
exit
error:
'MESSAGE("Script Cartouche.AmiCAD:"+CHR(10)+"Erreur en ligne 'SIGL'")'
exit